package sgg.algorithm.datastructure.recursion;

/**
 * @author: Michael
 * @date: 2025/4/29
 * @desc:
 */
public class RecursionTest {

    public static void main(String[] args) {
//        test(4);
        int n = factorial(4);
        System.out.println("n=" + n);
    }

    public static void test(int n) {
        if (n > 2) {
            test(n - 1);
        }
        System.out.println("n=" + n);
    }

    public static int factorial(int n) {
        if (n == 1) {
            return 1;
        }
        return n * factorial(n - 1);
    }
}
